package com.gun.self_properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @Authar: 吾图南
 * @Data: 2022/12/4 12:09
 * @Package: com.gun.self_properties
 * @ClassName: MyProperties
 * @Description: TODO 自定义的配置类
 */
@Configuration  // 配置类
@PropertySource("classpath:test.properties")
@EnableConfigurationProperties(MyProperties.class )
@ConfigurationProperties(prefix = "test")
public class MyProperties {

    private int id;
    private String name;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "MyProperties{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
